package net.hn.hnms.biz.support.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.hn.hnms.biz.support.domain.AnchordataNowPo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

/**
 * @InterfaceName: AnchordataNowMapper
 * @Description 锚杆( 索)测点实时检测Mapper
 * @Author 王龙
 * @Date 2022-10-17
 * @Version 0.1
 */
@DS(value = "slave")
public interface AnchordataNowMapper extends BaseMapper<AnchordataNowPo> {
    /**
     *
     * @param type  锚杆或锚索
     * @return
     */
    @Select(" select COALESCE(max(point_value),0) from dwd_cjdy_mgyl_now_anchordata where point_location like concat('%',#{type},'%')")
    BigDecimal maxValue(String type);
    /**
     *
     * @param type  锚杆或锚索 sensor_type  1301=锚杆   1302=锚索
     * @return
     */
    @Select(" select COALESCE(max(point_value),0) from dwd_cjdy_mgyl_now_anchordata where sensor_type like concat('%',#{type},'%')")
    BigDecimal maxSensorTypeValue(String type);

    /**
     * 有阈值 查询锚杆实时表今日所有报警列表
     * @param mineCode
     * @param thresholdValue
     * @param sensorTypeCode
     * @return
     */
    List<AnchordataNowPo> getTodayAlarmListByValue(@Param("mineCode") String mineCode, @Param("thresholdValue") BigDecimal thresholdValue, @Param("sensorTypeCode") String sensorTypeCode);
}
